import * as Cesium from '@cesiumjs';

  var _0x48893d = Cesium.ArcType;
  var _0x40cada = Cesium.arrayRemoveDuplicates;
  var _0x3d74cc = Cesium.BoundingSphere;
  var _0x198d61 = Cesium.Cartesian3;
  var _0x41ba7c = Cesium.Color;
  var _0x16e708 = Cesium.ComponentDatatype;
  var _0x59aa86 = Cesium.defaultValue;
  var _0x25c3e4 = Cesium.defined;
  var _0x5286a6 = Cesium.DeveloperError;
  var _0x5d5897 = Cesium["Ellipsoid"];
  var _0x4dadcb = Cesium['Geometry'];
  var _0x57b5c2 = Cesium['GeometryAttribute'];
  var _0x5941b5 = Cesium['GeometryAttributes'];
  var _0x40a465 = Cesium["GeometryType"];
  var _0xcd4458 = Cesium["IndexDatatype"];
  var _0x16b3e7 = Cesium["Math"];
  var _0x25a8ef = Cesium['PolylinePipeline'];
  var _0x3d5ff8 = Cesium["PrimitiveType"];
  var _0x119561 = Cesium.VertexFormat;
  var _0x5abda1 = [];

// _0xaa417d GeometryODLine
function GeometryODLine(options) {
  options = Cesium.defaultValue(options, Cesium.defaultValue.EMPTY_OBJECT);
  const {positions,colors} = options;
  var width = Cesium.defaultValue(options.width, 0x1);
  var colorsPerVertex = Cesium.defaultValue(options.colorsPerVertex, ![]);
  if (!Cesium.defined(positions) || positions.length < 0x2) {
    throw new Cesium.DeveloperError("At least two positions are required.");
  }
  if (typeof width !== "number") {
    throw new Cesium.DeveloperError("width must be a number");
  }
  if (Cesium.defined(colors) && (colorsPerVertex && colors.length < positions.length || !colorsPerVertex && colors.length < positions.length - 0x1)) {
    throw new Cesium.DeveloperError("colors has an invalid length.");
  }
  this["_positions"] = positions;
  this['_colors'] = colors;
  this["_width"] = width;
  this["_colorsPerVertex"] = colorsPerVertex;
  this["_vertexFormat"] = Cesium.VertexFormat.clone(Cesium.defaultValue(options.vertexFormat, Cesium.VertexFormat.DEFAULT));
  this["_arcType"] = Cesium.defaultValue(options.arcType, Cesium.ArcType.GEODESIC);
  this["_granularity"] = Cesium.defaultValue(options.granularity, Cesium.Math.RADIANS_PER_DEGREE);
  this['_ellipsoid'] = Cesium.Ellipsoid.clone(Cesium.defaultValue(options.ellipsoid, Cesium.Ellipsoid.WGS84));
  this["_workerName"] = "createPolylineGeometry";
  var _0x13c7ad = 0x1 + positions.length * Cesium.Cartesian3.packedLength;
  _0x13c7ad += Cesium.defined(colors) ? 0x1 + colors.length * Cesium.Color.packedLength : 0x1;
  this.packedLength = _0x13c7ad + Cesium.Ellipsoid.packedLength + Cesium.VertexFormat.packedLength + 0x4;
}

GeometryODLine.pack = function(options, arr, _0x11f33e) {
  if (!Cesium.defined(options)) {
    throw new Cesium.DeveloperError("options is required");
  }
  if (!Cesium.defined(arr)) {
    throw new Cesium.DeveloperError("array is required");
  }
  _0x11f33e = Cesium.defaultValue(_0x11f33e, 0x0);
  var _0x454e02;
  const positions = options['_positions'];
  var length = positions.length;
  arr[_0x11f33e++] = length;
  for (_0x454e02 = 0x0; _0x454e02 < length; ++_0x454e02, _0x11f33e += Cesium.Cartesian3.packedLength) {
    Cesium.Cartesian3.pack(positions[_0x454e02], arr, _0x11f33e);
  }
  var colors = options._colors;
  length = Cesium.defined(colors) ? colors['length'] : 0x0;
  arr[_0x11f33e++] = length;
  for (_0x454e02 = 0x0; _0x454e02 < length; ++_0x454e02, _0x11f33e += Cesium.Color['packedLength']) {
    Cesium.Color.pack(colors[_0x454e02], arr, _0x11f33e);
  }
  Cesium.Ellipsoid.pack(options._ellipsoid, arr, _0x11f33e);
  _0x11f33e += Cesium["Ellipsoid"].packedLength;
  Cesium.VertexFormat.pack(options["_vertexFormat"], arr, _0x11f33e);
  _0x11f33e += Cesium.VertexFormat['packedLength'];
  arr[_0x11f33e++] = options["_width"];
  arr[_0x11f33e++] = options["_colorsPerVertex"] ? 0x1 : 0x0;
  arr[_0x11f33e++] = options['_arcType'];
  arr[_0x11f33e] = options["_granularity"];
  return arr;
};

var _0x1d1393 = Cesium.Ellipsoid.clone(Cesium.Ellipsoid.UNIT_SPHERE);
var _0x35d727 = new Cesium.VertexFormat();
var _0x4da6da = {};
_0x4da6da.positions = undefined;
_0x4da6da.colors = undefined;
_0x4da6da.ellipsoid = _0x1d1393;
_0x4da6da.vertexFormat = _0x35d727;
_0x4da6da.width = undefined;
_0x4da6da.colorsPerVertex = undefined;
_0x4da6da.arcType = undefined;
_0x4da6da.granularity = undefined;

GeometryODLine.unpack = function(_0x1b8cc4, _0x483c31, _0xf0da28) {
  if (!Cesium.defined(_0x1b8cc4)) {
    if ("vaeqW" === 'REmSb') {
      _this._heatmap.setData({
        'min': _this._min,
        'max': _this._max,
        'data': _this._scratchData
      });
      _this._heatmapTexture.copyFrom(_this._heatmap._renderer.canvas);
    } else {
      throw new Cesium.DeveloperError("array is required");
    }
  }
  _0x483c31 = Cesium.defaultValue(_0x483c31, 0x0);
  var _0x40ca3d;
  var _0x270ff6 = _0x1b8cc4[_0x483c31++];
  var _0x23118e = new Array(_0x270ff6);
  for (_0x40ca3d = 0x0; _0x40ca3d < _0x270ff6; ++_0x40ca3d, _0x483c31 += Cesium.Cartesian3.packedLength) {
    _0x23118e[_0x40ca3d] = Cesium.Cartesian3["unpack"](_0x1b8cc4, _0x483c31);
  }
  _0x270ff6 = _0x1b8cc4[_0x483c31++];
  var _0x85ca1e = _0x270ff6 > 0x0 ? new Array(_0x270ff6) : undefined;
  for (_0x40ca3d = 0x0; _0x40ca3d < _0x270ff6; ++_0x40ca3d, _0x483c31 += Cesium.Color['packedLength']) {
    _0x85ca1e[_0x40ca3d] = Cesium.Color["unpack"](_0x1b8cc4, _0x483c31);
  }
  var _0x28fe05 = Cesium["Ellipsoid"]["unpack"](_0x1b8cc4, _0x483c31, _0x1d1393);
  _0x483c31 += Cesium["Ellipsoid"]['packedLength'];
  var _0x195006 = Cesium.VertexFormat["unpack"](_0x1b8cc4, _0x483c31, _0x35d727);
  _0x483c31 += Cesium.VertexFormat.packedLength;
  var _0x58bc91 = _0x1b8cc4[_0x483c31++];
  var _0x302e1f = _0x1b8cc4[_0x483c31++] === 0x1;
  var _0x5e1de4 = _0x1b8cc4[_0x483c31++];
  var _0x2a71d0 = _0x1b8cc4[_0x483c31];
  if (!Cesium.defined(_0xf0da28)) {
    _0x4da6da["positions"] = _0x23118e;
    _0x4da6da['colors'] = _0x85ca1e;
    _0x4da6da["width"] = _0x58bc91;
    _0x4da6da["colorsPerVertex"] = _0x302e1f;
    _0x4da6da.arcType = _0x5e1de4;
    _0x4da6da['granularity'] = _0x2a71d0;
    return new GeometryODLine(_0x4da6da);
  }
  _0xf0da28._positions = _0x23118e;
  _0xf0da28._colors = _0x85ca1e;
  _0xf0da28._ellipsoid = Cesium.Ellipsoid.clone(_0x28fe05, _0xf0da28._ellipsoid);
  _0xf0da28._vertexFormat = Cesium.VertexFormat.clone(_0x195006, _0xf0da28._vertexFormat);
  _0xf0da28._width = _0x58bc91;
  _0xf0da28._colorsPerVertex = _0x302e1f;
  _0xf0da28['_arcType'] = _0x5e1de4;
  _0xf0da28._granularity = _0x2a71d0;
  return _0xf0da28;
};

var _0x1e4926 = new Cesium.Cartesian3();
var _0x4b9e33 = new Cesium.Cartesian3();
var _0x18c958 = new Cesium.Cartesian3();
var _0xa9628a = new Cesium.Cartesian3();
GeometryODLine.createGeometry = function(_0x2a3f57) {
  var _0x575511 = _0x2a3f57['_width'];
  var _0x56186f = _0x2a3f57._vertexFormat;
  var _0x101e94 = _0x2a3f57["_colors"];
  var _0x38aa03 = _0x2a3f57['_colorsPerVertex'];
  var _0x5993a4 = _0x2a3f57["_arcType"];
  var _0x2d2270 = _0x2a3f57['_granularity'];
  var _0x4fd6cb = _0x2a3f57["_ellipsoid"];
  var _0x3776ad, _0x3b504a, _0x20d015;
  var _0x473e00 = _0x40cada(_0x2a3f57["_positions"], Cesium.Cartesian3["equalsEpsilon"]);
  var _0x23c944 = _0x473e00["length"];
  if (_0x23c944 < 0x2 || _0x575511 <= 0x0) {
    return undefined;
  } 
  if (_0x5993a4 === _0x48893d["GEODESIC"] || _0x5993a4 === _0x48893d["RHUMB"]) {
    var _0x1a13e7,_0x1e25ac;
    if (_0x5993a4 === _0x48893d["GEODESIC"]) {
      _0x1a13e7 = _0x16b3e7["chordLength"](_0x2d2270, _0x4fd6cb["maximumRadius"]);
      _0x1e25ac = _0x25a8ef["numberOfPoints"];
    } else {
      _0x1a13e7 = _0x2d2270;
      _0x1e25ac = _0x25a8ef['numberOfPointsRhumbLine'];
    }
    var _0x2d285f = _0x25a8ef['extractHeights'](_0x473e00, _0x4fd6cb);
    if (Cesium.defined(_0x101e94)) {
      var _0x144ad0 = 0x1;
      for (_0x3776ad = 0x0; _0x3776ad < _0x23c944 - 0x1; ++_0x3776ad) {
        _0x144ad0 += _0x1e25ac(_0x473e00[_0x3776ad], _0x473e00[_0x3776ad + 0x1], _0x1a13e7);
      }
      var _0xe0130 = new Array(_0x144ad0);
      var _0x34ae0e = 0x0;
      for (_0x3776ad = 0x0; _0x3776ad < _0x23c944 - 0x1; ++_0x3776ad) {
        var _0x39112a = _0x473e00[_0x3776ad];
        var _0x172d48 = _0x473e00[_0x3776ad + 0x1];
        var _0x38b574 = _0x101e94[_0x3776ad];
        var _0x5747f6 = _0x1e25ac(_0x39112a, _0x172d48, _0x1a13e7);
        if (_0x38aa03 && _0x3776ad < _0x144ad0) {
          var _0x1dddc9 = _0x101e94[_0x3776ad + 0x1];
          var _0x18fcc7 = _0x2fc6d1(_0x39112a, _0x172d48, _0x38b574, _0x1dddc9, _0x5747f6);
          var _0x4721df = _0x18fcc7["length"];
          for (_0x3b504a = 0x0; _0x3b504a < _0x4721df; ++_0x3b504a) {
            _0xe0130[_0x34ae0e++] = _0x18fcc7[_0x3b504a];
          }
        } else {
          for (_0x3b504a = 0x0; _0x3b504a < _0x5747f6; ++_0x3b504a) {
            _0xe0130[_0x34ae0e++] = Cesium.Color['clone'](_0x38b574);
          }
        }
      }
      _0xe0130[_0x34ae0e] = Cesium.Color['clone'](_0x101e94[_0x101e94["length"] - 0x1]);
      _0x101e94 = _0xe0130;
      _0x5abda1["length"] = 0x0;
    }
    if (_0x5993a4 === _0x48893d["GEODESIC"]) {
      _0x473e00 = _0x25a8ef["generateCartesianArc"]({
        'positions': _0x473e00,
        'minDistance': _0x1a13e7,
        'ellipsoid': _0x4fd6cb,
        'height': _0x2d285f
      });
    } else {
      _0x473e00 = _0x25a8ef["generateCartesianRhumbArc"]({
        'positions': _0x473e00,
        'granularity': _0x1a13e7,
        'ellipsoid': _0x4fd6cb,
        'height': _0x2d285f
      });
    }
  }
  _0x23c944 = _0x473e00['length'];
  var _0x33c33d = _0x23c944 * 0x4 - 0x4;
  var _0x37ba61 = new Float64Array(_0x33c33d * 0x3);
  var _0x772295 = new Float64Array(_0x33c33d * 0x3);
  var _0x23956e = new Float64Array(_0x33c33d * 0x3);
  var _0x5d41d9 = new Float32Array(_0x33c33d * 0x2);
  var _0xde2034 = _0x56186f['st'] ? new Float32Array(_0x33c33d * 0x2) : undefined;
  var _0x2cb44f = Cesium.defined(_0x101e94) ? new Uint8Array(_0x33c33d * 0x4) : undefined;
  var _0x55c070 = 0x0;
  var _0x29b53f = 0x0;
  var _0x49632f = 0x0;
  var _0x4af106 = 0x0;
  var _0x1d27cd;
  var _0x8471b8 = [0x0]; {
    for (_0x3776ad = 0x0; _0x3776ad < _0x23c944 - 0x1; _0x3776ad++) {
      var _0x322425 = Cesium["Cartesian3"]['distance'](_0x473e00[_0x3776ad], _0x473e00[_0x3776ad +
      0x1]);
      _0x8471b8["push"](_0x8471b8[_0x8471b8["length"] - 0x1] + _0x322425);
    }
    _0x8471b8 = _0x8471b8['map'](function(_0x3516fa) {
      return _0x3516fa / _0x8471b8[_0x8471b8['length'] - 0x1];
    });
  }
  for (_0x3b504a = 0x0; _0x3b504a < _0x23c944; ++_0x3b504a) {
    if (_0x3b504a === 0x0) {
      _0x1d27cd = _0x1e4926;
      Cesium.Cartesian3["subtract"](_0x473e00[0x0], _0x473e00[0x1], _0x1d27cd);
      Cesium.Cartesian3["add"](_0x473e00[0x0], _0x1d27cd, _0x1d27cd);
    } else {
      _0x1d27cd = _0x473e00[_0x3b504a - 0x1];
    }
    Cesium.Cartesian3["clone"](_0x1d27cd, _0x18c958);
    Cesium.Cartesian3['clone'](_0x473e00[_0x3b504a], _0x4b9e33);
    if (_0x3b504a === _0x23c944 - 0x1) {
      _0x1d27cd = _0x1e4926;
      Cesium.Cartesian3["subtract"](_0x473e00[_0x23c944 - 0x1], _0x473e00[_0x23c944 - 0x2], _0x1d27cd);
      Cesium.Cartesian3['add'](_0x473e00[_0x23c944 - 0x1], _0x1d27cd, _0x1d27cd);
    } else {
      _0x1d27cd = _0x473e00[_0x3b504a + 0x1];
    }
    Cesium.Cartesian3["clone"](_0x1d27cd, _0xa9628a);
    var _0x3f343a, _0x9841ac;
    if (Cesium.defined(_0x2cb44f)) {
      if (_0x3b504a !== 0x0 && !_0x38aa03) {
        _0x3f343a = _0x101e94[_0x3b504a - 0x1];
      } else {
        _0x3f343a = _0x101e94[_0x3b504a];
      }
      if (_0x3b504a !== _0x23c944 - 0x1) {
        _0x9841ac = _0x101e94[_0x3b504a];
      }
    }
    var _0x48a08f = _0x3b504a === 0x0 ? 0x2 : 0x0;
    var _0x57cff6 = _0x3b504a === _0x23c944 - 0x1 ? 0x2 : 0x4;
    for (_0x20d015 = _0x48a08f; _0x20d015 < _0x57cff6; ++_0x20d015) {
      if ("XqsLw" !== "smArw") {
        Cesium.Cartesian3["pack"](_0x4b9e33, _0x37ba61, _0x55c070);
        Cesium.Cartesian3["pack"](_0x18c958, _0x772295, _0x55c070);
        Cesium.Cartesian3["pack"](_0xa9628a, _0x23956e, _0x55c070);

        _0x55c070 += 0x3;
        var _0x437b3e = _0x20d015 - 0x2 < 0x0 ? -0x1 : 0x1;
        _0x5d41d9[_0x29b53f++] = 0x2 * (_0x20d015 % 0x2) - 0x1;
        _0x5d41d9[_0x29b53f++] = _0x437b3e * _0x575511;
        if (_0x56186f['st']) {
          _0xde2034[_0x49632f++] = _0x8471b8[_0x3b504a];
          _0xde2034[_0x49632f++] = Math['max'](_0x5d41d9[_0x29b53f - 0x2], 0x0);
        }
        if (Cesium.defined(_0x2cb44f)) {
          var _0x44c982 = _0x20d015 < 0x2 ? _0x3f343a : _0x9841ac;
          _0x2cb44f[_0x4af106++] = Cesium.Color["floatToByte"](_0x44c982["red"]);
          _0x2cb44f[_0x4af106++] = Cesium.Color["floatToByte"](_0x44c982["green"]);
          _0x2cb44f[_0x4af106++] = Cesium.Color["floatToByte"](_0x44c982["blue"]);
          _0x2cb44f[_0x4af106++] = Cesium.Color['floatToByte'](_0x44c982['alpha']);
        }
      } else {
        var _0xc307d7 = _0x1ef134(0x35);
        var _0x2ad51f = _0x1ef134(0x22);
        var _0x4e1d6c = _0x1ef134(0x1d);
        var _0x5593c1 = _0x1ef134(0x44);
        var _0x55b90a = _0x1ef134(0x1a);
        var _0x3a35ec = _0x1ef134(0x6a);
        var _0x11c576 = Object['getOwnPropertyDescriptor'];
        _0x3eebcf['f'] = _0x1ef134(0x14) ? _0x11c576 : function getOwnPropertyDescriptor(_0x1fb6a5, _0x30134d) {
          _0x1fb6a5 = _0x4e1d6c(_0x1fb6a5);
          _0x30134d = _0x5593c1(_0x30134d, !![]);
          if (_0x3a35ec) try {
            return _0x11c576(_0x1fb6a5, _0x30134d);
          } catch (_0x2103ac) {}
          if (_0x55b90a(_0x1fb6a5, _0x30134d)) return _0x2ad51f(!_0xc307d7['f']["call"](
            _0x1fb6a5, _0x30134d), _0x1fb6a5[_0x30134d]);
        };
      }
    }
  }
  var _0x1f27d2 = new _0x5941b5();
  _0x1f27d2["position"] = new _0x57b5c2({
    'componentDatatype': _0x16e708["DOUBLE"],
    'componentsPerAttribute': 0x3,
    'values': _0x37ba61
  });
  _0x1f27d2['prevPosition'] = new _0x57b5c2({
    'componentDatatype': _0x16e708["DOUBLE"],
    'componentsPerAttribute': 0x3,
    'values': _0x772295
  });
  _0x1f27d2["nextPosition"] = new _0x57b5c2({
    'componentDatatype': _0x16e708["DOUBLE"],
    'componentsPerAttribute': 0x3,
    'values': _0x23956e
  });
  _0x1f27d2["expandAndWidth"] = new _0x57b5c2({
    'componentDatatype': _0x16e708["FLOAT"],
    'componentsPerAttribute': 0x2,
    'values': _0x5d41d9
  });

  if (_0x56186f['st']) {
    if ("tFFGS" === "yfuzG") {
      fragmentShader +=
        '\x20\x20\x20\x20vec4\x20baseColorWithAlpha\x20=\x20u_baseColorFactor;\x20baseColorWithAlpha.rgb\x20*=\x20(5.0*gltf_luminanceAtZenith);\x0a';
    } else {
      _0x1f27d2['st'] = new _0x57b5c2({
        'componentDatatype': _0x16e708['FLOAT'],
        'componentsPerAttribute': 0x2,
        'values': _0xde2034
      });
    }
  }
  if (Cesium.defined(_0x2cb44f)) {
    if ('qrFvv' === "kdjLH") {
      if (!this["isStopped"]) {
        this['_next'](value);
      }
    } else {
      _0x1f27d2["color"] = new _0x57b5c2({
        'componentDatatype': _0x16e708["UNSIGNED_BYTE"],
        'componentsPerAttribute': 0x4,
        'values': _0x2cb44f,
        'normalize': !![]
      });
    }
  }
  var _0xf63ca4 = _0xcd4458["createTypedArray"](_0x33c33d, _0x23c944 * 0x6 - 0x6);
  var _0x3808f5 = 0x0;
  var _0x22d013 = 0x0;
  var _0x238da3 = _0x23c944 - 0x1;
  for (_0x3b504a = 0x0; _0x3b504a < _0x238da3; ++_0x3b504a) {
    _0xf63ca4[_0x22d013++] = _0x3808f5;
    _0xf63ca4[_0x22d013++] = _0x3808f5 + 0x2;
    _0xf63ca4[_0x22d013++] = _0x3808f5 + 0x1;
    _0xf63ca4[_0x22d013++] = _0x3808f5 + 0x1;
    _0xf63ca4[_0x22d013++] = _0x3808f5 + 0x2;
    _0xf63ca4[_0x22d013++] = _0x3808f5 + 0x3;
    _0x3808f5 += 0x4;
  }
  return new _0x4dadcb({
    'attributes': _0x1f27d2,
    'indices': _0xf63ca4,
    'primitiveType': _0x3d5ff8["TRIANGLES"],
    'boundingSphere': _0x3d74cc['fromPoints'](_0x473e00),
    'geometryType': _0x40a465["POLYLINES"]
  });
};

export default GeometryODLine;
